import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase = "DBshop019_添加属性组"
firefox=openBrowser(urlAdmin)
DBshopLoginAdmin(firefox)
DBshopEnterMenu3(firefox,'商品管理','商品属性','属性')
# 添加属性
firefox.find_element_by_link_text("添加属性").click()
from selenium.webdriver.support.select import Select
s1 = Select(firefox.find_element_by_id("attribute_group_id"))
s1.select_by_visible_text("好好学习")

s2 = Select(firefox.find_element_by_id("attribute_type"))
s2.select_by_visible_text("下拉")

firefox.find_element_by_id("attribute_name").send_keys("天天向上")
firefox.find_element_by_id("attribute_sort").clear()
firefox.find_element_by_id("attribute_sort").send_keys(255)
firefox.find_element_by_xpath("//button").click()
# 断言
n= firefox.find_element_by_xpath("/html/body/div[2]/div/div[2]/form/table/tbody/tr[1]/td[2]").text
print(n)
s = "天天向上"
if n ==s:
    writeLog("%s 测试通过" % testCase)
else:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()